package com.health.tools;

import com.health.NovaApplication;

import android.content.Context;
import android.text.TextUtils;

/**
 * 公共变量
 */
public class GlobalContsJTYS extends GlobalConts {

	// public static final String URL_POST2 =
	// "http://jtysapi.ideallife.wang:8081/";// 家庭签约医生(正式地址)
//	public static final String URL_POST2 = "http://jtysapi.ideallife.wang:8081/";// 家庭签约医生(正式地址)
//	public static final String URL_POST2 = "http://192.168.10.25:8080/health-apis-web_V1.1.0Beta5/";// 家庭签约医生(修改后地址)
//	public static final String URL_POST2 = "http://192.168.55.104:8088/";// 家庭签约医生(刘义东)
//	public static final String URL_POST2 = "http://130.130.51.83:9108/health-apis-web/";// 家庭签约医生(刘义东20180111)
	public static final String URL_POST2 = "http://znjtysapi.ideallife.wang:8082/";// 家庭签约医生(正式地址)
	public static String getUrlPost_JTYS() {
		if (TextUtils.isEmpty(NovaApplication.updateJTYSUrl)) {
			return TextUtils.isEmpty(SPUtil.getSTR_UPLOAD_JTYS_ADDRESS(NovaApplication.getInstance()))
					? URL_POST2 : SPUtil.getSTR_UPLOAD_JTYS_ADDRESS(NovaApplication.getInstance());
		} else {
			return NovaApplication.updateJTYSUrl;
		}
	}
	public static final String CONFIG_ACTIVITY = "CONFIG_ACTIVITY";
	public static final String CONFIG1 = "GONFIG1";
	public static final String CONFIG2 = "GONFIG2";

	// ftp上传端口号

	public static final String IMG_FOLDERS = "/PublicHealthJTYS/images";
	public static final String FILES_FOLDER = "/PublicHealthJTYS/DownloadFiles/";
	public static final String CE_LIANG_FILE = "/PublicHealthJTYS/.nomedia/";
	public static final String CE_LIANG_ECG_FILE = "/PublicHealthJTYS/.nomedia/ecg/";
	public static final String MENU_SETTINGS_FIRST = "settings_first";
	public static final String MENU_UPLOAD = "upload";
	public static final String MENU_DOWNLOAD = "download";
	public static final String MENU_SYNCHRONIZATION = "synchronization";

	public static final String URL_POST_UPDATE = "http://apis.wo100.com.cn/";

	/**
	 * 保存数据信息 no 为对应的编号
	 *
	 * @param str_xz
	 *            乡镇
	 * @param str_cz
	 *            村庄
	 * @param str_jddw
	 *            建档单位
	 * @param str_jdr
	 *            建档人
	 * @param jdrno
	 *            建档人编号 str_ssqno 省市区编号----对应 个人档案编号 str_jdpassward 密码 str_xzq
	 *            行政区编号【用于更新数据库】
	 * @author 王婷婷
	 * @date 2015年12月10日 下午3:41:38
	 */
	public static void saveID(Context context, String str_xz, String str_xzno, String str_cz, String str_czno,
							  String str_jddw, String str_jddwno, String str_jdr, String str_jdrno, String str_ssqno, String str_xzq,
							  String str_jdpassward, String str_p, String str_c, String str_n, String str_jdrusername) {
		SPUtil.setstr_xz(context, str_xz);
		SPUtil.setstr_xzno(context, str_xzno);
		SPUtil.setstr_cz(context, str_cz);
		SPUtil.setstr_czno(context, str_czno);
		SPUtil.setstr_jddw(context, str_jddw);
		SPUtil.setStrjddwno(context, str_jddwno);
		SPUtil.setstr_jdr(context, str_jdr);
		SPUtil.setStr_jdrno(context, str_jdrno);
		SPUtil.setstr_ssqno(context, str_ssqno);
		SPUtil.setstr_xzq(context, str_xzq);
		SPUtil.setstr_jdpassward(context, str_jdpassward);
		SPUtil.setstr_p(context, str_p);
		SPUtil.setstr_c(context, str_c);
		SPUtil.setstr_n(context, str_n);
		SPUtil.setstr_jdrusername(context, str_jdrusername);
	}

	public static boolean isLogin(Context context) {
		if (TextUtils.isEmpty(SPUtil.getstr_ssqno(context))) {
			return false;
		}
		return true;
	}

	public static void clearID(Context context) {
		SPUtil.setstr_xz(context, "");
		SPUtil.setstr_xzno(context, "");
		SPUtil.setstr_cz(context, "");
		SPUtil.setstr_czno(context, "");
		SPUtil.setstr_jddw(context, "");
		SPUtil.setStrjddwno(context, "");
		SPUtil.setstr_jdr(context, "");
		SPUtil.setStr_jdrno(context, "");
		SPUtil.setstr_ssqno(context, "");
		SPUtil.setstr_xzq(context, "");
		SPUtil.setstr_jdpassward(context, "");
		SPUtil.setstr_p(context, "");
		SPUtil.setstr_c(context, "");
		SPUtil.setstr_n(context, "");
		SPUtil.setstr_jdrusername(context, "");
	}

	public static final String SPINNER_P = "SPINNER_P";
	public static final String SPINNER_C = "SPINNER_C";
	public static final String SPINNER_N = "SPINNER_N";
	public static final String SPINNER_JD = "SPINNER_JD";
	public static final String SPINNER_BCS = "SPINNER_BCS";
	public static final String SPINNER_XZ = "SPINNER_P_XZ";
	public static final String SPINNER_CZ = "SPINNER_CZ";
	public static final String SPINNER_EMPLOYEE = "SPINNER_EMPLOYEE";
	private static final String IS_LOGIN = "IS_LOGIN";

	public static void setLoginInfo(Context context, String spinnerKey, int position) {
		SPUtil.saveInt(context, SPUtil.SP_NAME, spinnerKey, position);
		SPUtil.saveBoolean(context, SPUtil.SP_NAME, IS_LOGIN, true);
		Log("setLoginInfo"+position+spinnerKey);
	}

	public static int getLoginInfo(Context context, String spinnerKey) {
		Log("getLoginInfo"+SPUtil.getInt(context, SPUtil.SP_NAME, spinnerKey)+spinnerKey);
		return SPUtil.getInt(context, SPUtil.SP_NAME, spinnerKey);
	}

	public static boolean isLogin(Context context, String spinner) {
		Log("isLogin");
		return SPUtil.getBoolean(context, SPUtil.SP_NAME, IS_LOGIN);
	}

	public static void exit(Context context) {
		Log("exit");
		SPUtil.saveBoolean(context, SPUtil.SP_NAME, IS_LOGIN, false);
	}

	private static void Log(String s) {

	}
	
}